package com.example.smartcity_poverty.ui.AllService.PetHospital.adapter

import android.content.Intent
import com.example.smartcity_poverty.App.Companion.url
import com.example.smartcity_poverty.Base.BaseRecyclerAdapter
import com.example.smartcity_poverty.logic.ServiceBean.PetHospitalBean.JsThisAllModel
import com.example.smartcity_poverty.logic.util.Util.glide
import com.example.smartcity_poverty.ui.AllService.PetHospital.activity.JsThisAddTrueActivity
import kotlinx.android.synthetic.main.re_js_this_all_list.*

/**
 *  created by ikun
 *  ANDROID STUDIO - version 4.0
 *  email: jinkunwei41@gmail.com
 * --------------------------------
 *
 **/
class JsThisAdapter(
    val list: MutableList<JsThisAllModel.RowsBean>,
    layoutId: Int
) : BaseRecyclerAdapter<JsThisAllModel.RowsBean>(list, layoutId) {
    override fun setData(
        view: BaseViewHolder.ViewFind,
        data: JsThisAllModel.RowsBean,
        position: Int,
        holder: BaseViewHolder
    ) {
        val d = list[position]
        val con = holder.viewFind.view?.context


        glide(url + d.avatar, view.phMeListImageThis)
        view.phMeListNameThis.text = d.name
        view.phMeListNameThisTv1.text = "职称: ${d.jobName}"
        view.phMeListNameThisTv2.text = "执业编号: ${d.practiceNo}"
        view.phMeListNameThisTv3.text = "从业年限: ${d.workingYears}"
        view.phMeListNameThisTv4.text = "擅长描述: ${d.goodAt}"

        holder.itemView.setOnClickListener {
            con?.startActivity(Intent(con, JsThisAddTrueActivity::class.java).apply {
                putExtra("rows", list[position])
            })
        }
    }
}